package com.fraud;

import java.io.InputStream;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.Properties;

import com.ibm.wsdl.Constants;

public class Util {

	private static Properties prop = null;

	public final static String ftpFilePrefix = "F_";
	public final static String windowsFilePrefix = "W_";

	public final static String waitingFilePrefix = "-";

	public final static int systemKullanciId = 1;

	public static String jobScheduleHour="" ; // 

	static{
		jobScheduleHour = Util.getProp("jobschedule.hour");
	}
	
	
	public final static String getDownloadFileName(Date islemTarihi) {

		String fileFormat = Util.getProp("fileFormat");
		SimpleDateFormat format = new SimpleDateFormat("yyMMdd");
		String date = format.format(islemTarihi);

		String fileName = fileFormat.replaceAll("tarih", date);
		return fileName;
	}

	public static String getProp(String key) {

		if (prop == null) {
			try {
				ClassLoader loader = Thread.currentThread()
						.getContextClassLoader();
				InputStream stream = loader
						.getResourceAsStream("/application.properties");
				prop = new Properties();

				prop.load(stream);

			} catch (Exception e) {
				e.printStackTrace();
				prop = null;
				return "";
			}
		}
		return prop.getProperty(key);
	}

}